import { Component, OnInit } from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {HomeConfigService} from '../../../../lib/service/admin/home-config.service';
import {AliyunOssOutputUrl} from '../../../../../config/api';

@Component({
  selector: 'app-config-detail',
  templateUrl: './config-detail.component.html',
  styleUrls: ['./config-detail.component.scss']
})
export class ConfigDetailComponent implements OnInit {

  detailData: any = '';
  aliyunOssOutputUrl = AliyunOssOutputUrl;
  constructor(private homeConfigService: HomeConfigService, private route: ActivatedRoute) { }

  ngOnInit() {
    let id = +this.route.snapshot.params['id'];
    this.getDetail(id);
  }

  //获取详情信息
  getDetail(id: number){
   this.homeConfigService.getHomeConfigDetail(id)
      .subscribe(
        res => {
          if (res.code === 2000) {
            this.detailData = res.data;
          } else {
            alert(res.code + ',' + res.message);
          }
        }
      )
  }
}
